<template>
  <div class="home">
    <van-button plain type="primary" @click="add">添加</van-button>

    <van-button plain type="primary" @click="remove">删除</van-button>
  </div>
</template>

<script>
// import { Toast } from "vant";
// 通过解构赋值的形式引入toast

// import { Dialog } from "vant";

export default {
  methods: {
    add() {
      // Toast("添加成功");
      this.$toast("添加完成");
    },
    remove() {
      this.$dialog
        .confirm({
          title: "删除",
          message: "是否确认删除",
        })
        .then(() => {
          // on confirm
          // this.list.splice(i,1)
          this.$toast("删除成功");
        })
        .catch(() => {
          // on cancel
        });
    },
  },
};
</script>
